{% extends "task_base.html" %}

{% load i18n %}
{% load bootstrap %}

{% block body_class %}{% endblock %}

{% block head_title %}{% trans "Account" %}{% endblock %}

{% block body %}
    <div class="row">
        <div class="">
            <h2>定时任务</h2>
            {% if not object_list %}
                暂无任务配置
            {% else %}
                <table class="table table-striped">
                  <thead>
                    <tr>
                      <th>#</th>
                      <th>简介</th>
                      <th>创建人</th>
                      <th>项目名</th>
                      <th>执行命令</th>
                      <th>数据库依赖</th>
                      <th>当前状态</th>
                    </tr>
                  </thead>
                  <tbody>
                  {% for each in object_list %}
                    <tr>
                      <th scope="row"><a href="{% url 'edit_crontab' id=each.id %}">{{ each.id }}</a></th>
                      <td><a href="{% url 'edit_crontab' id=each.id %}">{{ each.desc }}</a></td>
                      <td>{{ each.user }}</td>
                      <td>{{ each.project }}</td>
                      <td>{{ each.command }}</td>
                      <td>{{ each.sql_ref }}</td>
                      <td>
                          {% if each.status == 0 %}
                              <span class="glyphicon glyphicon-stop text-warning"></span> 待上线
                          {% elif each.status == 1 %}
                              <span class="glyphicon glyphicon-play text-success"></span> 执行中
                          {% else %}
                              <span class="glyphicon glyphicon-trash text-muted"></span> 已失效
                          {% endif %}
                      </td>
                    </tr>
                  {% endfor %}
                  </tbody>
                </table>
            {% endif %}
        </div>
        {% include "pagination/builtin_pagination_reverse.html" %}
    </div>
{% endblock %}

